package com.lhnstart.learn.bases.do_question_;

/**
 * 03
 *
 * @author lhn
 * @date 2023/06/19 14:39
 * @since 1.0.0
 **/
public class Homework03 {

    public static void main(String[] args) {
        Teacher teacher1 = new Professor("张三", 50, "教授", 1.3);
        Teacher teacher2 = new AssociateProfessor("李四", 45, "副教授", 1.2);
        Teacher teacher3 = new Lecturer("王五", 40, "讲师", 1.1);
        teacher1.introduce();
        teacher2.introduce();
        teacher3.introduce();
    }

}

class Teacher {
    String name;
    int age;
    String post;
    double salary;

    public void introduce() {
        System.out.println("姓名" + name + "年龄" + age + "职称" + post + "基本工资" + salary);
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("Teacher{");
        sb.append("name='").append(name).append('\'');
        sb.append(", age=").append(age);
        sb.append(", post='").append(post).append('\'');
        sb.append(", salary=").append(salary);
        sb.append('}');
        return sb.toString();
    }
}

class Professor extends Teacher {

    String name;
    int age;
    String post;
    double salary;

    public Professor(String name, int age, String post, double salary) {
        this.name = name;
        this.age = age;
        this.post = post;
        this.salary = salary;
    }

    public void introduce() {
        System.out.println("教授姓名" + name + "年龄" + age + "职称" + post + "基本工资" + salary);
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("Professor{");
        sb.append("name='").append(name).append('\'');
        sb.append(", age=").append(age);
        sb.append(", post='").append(post).append('\'');
        sb.append(", salary=").append(salary);
        sb.append('}');
        return sb.toString();
    }
}

class AssociateProfessor extends Teacher {
    String name;
    int age;
    String post;
    double salary;

    public AssociateProfessor(String name, int age, String post, double salary) {
        this.name = name;
        this.age = age;
        this.post = post;
        this.salary = salary;
    }

    public void introduce() {
        System.out.println("副教授姓名" + name + "年龄" + age + "职称" + post + "基本工资" + salary);
    }
}

class Lecturer extends Teacher {
    String name;
    int age;
    String post;
    double salary;

    public Lecturer(String name, int age, String post, double salary) {
        this.name = name;
        this.age = age;
        this.post = post;
        this.salary = salary;
    }

    public void introduce() {
        System.out.println("讲师姓名" + name + "年龄" + age + "职称" + post + "基本工资" + salary);
    }
}